package com.example.mvpdemo.mvp2;

import com.example.mvpdemo.net.NetworkCallback;

public class LoginPresenter2 {
    private LoginModel2 loginModel2;
    private ILoginView2 loginView2;


    public LoginPresenter2() {
        loginModel2=new LoginModel2();
    }

    //绑定View
    public void attachView(ILoginView2 loginView2){
        this.loginView2=loginView2;
    }

    //解绑View
    public void detachView(ILoginView2 loginView2){
        this.loginView2=null;
    }

    public void login(String username,String psd){
        loginModel2.login(username, psd, new NetworkCallback() {
            @Override
            public void result(String result) {
                if (loginView2!=null)
                    loginView2.onLoginResult(result);
            }
        });
    }


}
